import 'package:chaos_flutter3/app/consts/ImageUrlString.dart';
import 'package:chaos_flutter3/app/consts/LabelString.dart';
import 'package:chaos_flutter3/app/notifications/TabChangeMyNotification.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';

class BaseBottomNavigationBar extends HookWidget  {

  const BaseBottomNavigationBar({Key? key}) : super(key: key);


  // final  List _imageUrls = [
  //   {
  //     'imageUrl': ImageUrl.bottomImage,
  //     'activeImageUrl': ImageUrl.bottomImageChecked
  //   },
  //   {
  //     'imageUrl': ImageUrl.bottomImage,
  //     'activeImageUrl': ImageUrl.bottomImageChecked
  //   },
  //   {
  //     'imageUrl': ImageUrl.bottomImage,
  //     'activeImageUrl': ImageUrl.bottomImageChecked
  //   },
  //   {
  //     'imageUrl': ImageUrl.bottomImage,
  //     'activeImageUrl': ImageUrl.bottomImageChecked
  //   },
  // ];

  @override
  Widget build(BuildContext context) {
    final activeTabIndex = useState(0);
    // index == activeTabIndex
    //     ? _imageUrls[index]['activeImageUrl']
    //     : _imageUrls[index]['imageUrl'],
    buildIcon(index) => Image.asset(
        ImageUrl.tabPath,
        width: 25.0,
        height: 25.0);

    List<BottomNavigationBarItem> bars = [
      BottomNavigationBarItem(icon: buildIcon(0), label: LabelString.info),
      BottomNavigationBarItem(icon: buildIcon(1), label: LabelString.mine),
    ];

    return BottomNavigationBar(
        items: bars.map((item) => item).toList(),
        currentIndex: activeTabIndex.value,
        onTap: (index) {
          activeTabIndex.value = index;
          TabChangeMyNotification(index).dispatch(context);
        },
        backgroundColor: const Color(0xfff6f9f8),
        type: BottomNavigationBarType.fixed,
        selectedItemColor: const Color(0xff4F4F53),
        unselectedItemColor: const Color(0xffB6B8B9));
  }
}
